package com.aegean.CommercialHotelBookSystem.admin.action;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.aegean.CommercialHotelBookSystem.admin.business.IAdminBusiness;
import com.aegean.CommercialHotelBookSystem.factory.BusinessFactory;

/**
 * Servlet implementation class SearchAdmin
 */
public class SearchAdmin extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public SearchAdmin() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		String No=request.getParameter("No");
		IAdminBusiness business=BusinessFactory.createAdminBusiness();
		boolean result=business.searchAdmin(No);
		response.setContentType("text/html;charset=UTF-8");
		PrintWriter out = response.getWriter();
		if(result==true){
			out.println(true);
		}else{
			out.println(false);
		}
	}

}
